﻿//using AduSkin.Demo.UserControls;
using GrabFieldr.ViewModels;
using GrabFieldr.Models.Impls;
using GrabFieldr.Models.Interface;
using NewDeMo.ViewModels;
using NewDeMo.Views;
using Prism.Ioc;
using Prism.Mvvm;
using System.Configuration;
using System.Data;
using System.Windows;
//using GrabFieldr.ViewModels;
using GrabFieldr.Views;

namespace NewDeMo
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : PrismApplication
    {
        protected override Window CreateShell()
        {
            return Container.Resolve<MainWindow>();
        }

        protected override void OnStartup(StartupEventArgs e)
        {
            System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
            base.OnStartup(e);
            NavigationParameters keyValuePairs = new NavigationParameters();
            keyValuePairs.Add("data", 123);
            
            //在此处注册 (局部不需要 全局就需要)
            //Container.Resolve<IRegionManager>().RegisterViewWithRegion("ContentRegion", typeof(ExtrPlat));
            //Container.Resolve<IRegionManager>().RegisterViewWithRegion("ContentRegion", typeof(HomePage));
            //Container.Resolve<IRegionManager>().RegisterViewWithRegion("ContentRegion", typeof(MainWindow));

        }

        protected override void RegisterTypes(IContainerRegistry containerRegistry)
        {
            //containerRegistry.RegisterTypeForNavigation<ExtrPlat, ExtrPlatViewModel>();
            containerRegistry.Register<IMachineModel, MachineModel>();
            containerRegistry.RegisterForNavigation<ExtrPlat>(nameof(ExtrPlat));
            containerRegistry.RegisterForNavigation<HomePage>(nameof(HomePage));
            containerRegistry.RegisterForNavigation<GrabFieldr.Views.Tools.DB>(nameof(GrabFieldr.Views.Tools.DB));
            //containerRegistry.RegisterForNavigation<PracticalCase,PracticalCaseViewModel>();
            //containerRegistry.RegisterForNavigation<PracticalCase>(nameof(PracticalCase));
            containerRegistry.RegisterInstance<PracticalCaseViewModel>(Container.Resolve<PracticalCaseViewModel>());
            containerRegistry.RegisterInstance<PracticalCase>(Container.Resolve<PracticalCase>());

            //containerRegistry.RegisterForNavigation<HomePage>(nameof(MainWindow));

            // 注册导航视图
            //containerRegistry.RegisterForNavigation<HomePage>();
            //containerRegistry.RegisterForNavigation<ExtrPlat>();
        }
    }

}
